<template>
  <div>
    文章发布
    <div>
      文章标题<input type="text" v-model="addarc.title" /> 是否公开<input
        type="checkbox"
        name=""
        id=""
        v-model="addarc.state"
      />
      内容<input type="text" name="" id="" v-model="addarc.content" />
      <button @click="AddArticle()">发布</button><button @click="reset()">重置</button>
    </div>
  </div>
</template>
<script setup>
import { AddReq } from '@/api/Requst'
import { ref } from 'vue'

let addarc = ref({
  title: '',
  state: false,
  content: ''
})
function AddArticle() {
  console.log(addarc.value)
  AddReq(addarc.value.title, addarc.value.content, addarc.value.state).then((res) => {
    console.log(res)
  })
}

function reset() {
  addarc.value = {
    title: '',
    state: false,
    content: ''
  }
}
</script>
<style lang=""></style>
